<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <link rel="stylesheet" type="text/css" href="../../css/aui.css" />
    <link rel="stylesheet" type="text/css" href="circle_style.css" />
</head>
<body>
<div id="pic">

</div>
    <a  class="file">选择文件
        <input id="files" type="file" multiple = "multiple" onchange="drawFile()">
    </a>

<div id="content" style="width: 90%; position: relative; margin-left: 5%;height: 500px;border: 3px; border-radius: 10px;background-color: white">
    <input type="text" placeholder="请输入标题" style="color: grey;width: 90%;height: 50px;margin-left: 5%">
    <div id="guo" aria-placeholder="请输入正文" style="color: grey;height:300px;width: 90%;margin-left: 5%" contenteditable="true"></div>
</div>
</body>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/jquery.js"></script>
<script type="text/javascript">
    var basicURL = "http://1.82.238.228/api/";
    var fileBrowser;
    var i = 0;
    var fileList = new Array(File);
    apiready = function(){
        api.parseTapmode();
        fileBrowser = api.require('fileBrowser');

    };
    function drawFile() {
        var f = document.getElementById('files').files[0];
        fileList.push(f);
        i++;
        var pic = document.getElementById('pic');
        var s = f.name.split('.')[1];
        pic.innerHTML = pic.innerHTML + "<div class=\"aui-card-list\" style=\"width: 90%\">\n" +
            "        <div class=\"aui-card-list-header\" tapmode onclick=\"openResourceD()\" style=\"width: 100%\">\n" +
            "            <div class=\"resource-left\">\n" +
            "                <div id=\"resource-type\" class=\"resource-imag\">\n" +
            "                    "+s+"\n" +
            "                </div>\n" +
            "            </div>\n" +
            "            <div class=\"rightR\">\n" +
            "                <div class=\"nameR\">"+f.name+"</div>\n" +
            "                <div>\n" +
            "                </div>\n" +
            "            </div>\n" +
            "        </div>\n" +
            "    </div>"
    }
    function uploadFile() {
        var t = fileList[0];
        var formdata = new FormData();
        formdata.append('file',t);
        formdata.append('type','public');
        $.ajax({
            url:'http://1.82.238.228/api/upload/',
            method:'post',
            data:formdata,
            contentType:false,
            processData:false,
            success:function (ret) {
                if (ret){
                    alert(JSON.stringify(ret))
                }
            }
        })

    }
    function closeWin(){
        api.closeWin({
        });
    }
</script>
</html>